<%--
  Created by IntelliJ IDEA.
  User: 97990
  Date: 2022/7/4
  Time: 14:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录页面</title>
    <!-- Bootstrap -->
    <link href="/js/bootstrap3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<form class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-4 control-label">用户名:</label>
        <div class="col-sm-4">
            <input type="text" id="userName" class="form-control"  placeholder="请输入用户名">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-4 control-label">密码:</label>
        <div class="col-sm-4">
            <input type="password" id="pwd" class="form-control"  placeholder="请输入密码">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-info" onclick="login();"><span class="glyphicon glyphicon-ok"></span>登录</button>
            <button type="reset" class="btn btn-warning"><i class="glyphicon glyphicon-refresh"></i>重置</button>
        </div>
    </div>
</form>

<jsp:include page="/common/script.jsp"></jsp:include>
<script>
    function login(){
        var v_param = {}
        v_param.userName = $("#userName").val();
        v_param.password = $("#pwd").val();
        $.ajax({
            type:"post",
            url:"/user/login.do",
            data:v_param,
            success:function (res){
                if (res.code == 200){
                    location.href = "/user/toList.do"
                }else {
                    // 提示
                    bootbox.alert({
                        message: "<span class='glyphicon glyphicon-exclamation-sign'></span>"+res.msg,
                        size: 'small',
                        title: "提示信息"
                    });
                }
            }
        })
    }
</script>
</body>
</html>
